
import EditTopicForm from "@/components/EditTopicForm";

const getTopicById = async (id: string) => {
    const res = await fetch(`http://localhost:3000/api/topics/${id}`, { cache: "no-store" });
    const { topic } = await res.json();
    return topic;
}

export default async function Page({ params }: any) {
    const { id } = params;
    const topic = await getTopicById(id);
    const { title, description } = topic;

    return (
        <EditTopicForm id={id} title={title} description={description} />
    )
}